//
// Created by 78472 on 2022/5/15.
//

#ifndef EXHIBITION_SERVICEREQUESTHANDLER_H
#define EXHIBITION_SERVICEREQUESTHANDLER_H

#include <string>
#include <http/httplib.h>
using namespace httplib;

namespace synergy{



//场景指令转换解析 + 设备控制（软服请求）
    int cloudCommand_service_handler(const Request& request, Response& response);


    /**
     * @brief 获取本地场景文件、匹配场景名，执行场景涉及到的设备控制动作
     * 
     * @param request 
     * @param response 
     * @return int 
     */
    int sceneControl_service_handler(const Request& request, Response& response);



    /**
     * @brief 设备控制
     * 
     * @param request 
     * @param response 
     * @return int 
     */
    int deviceControl_service_handler(const Request& request, Response& response);


    /**
     * @brief 获取设备列表
     * 
     * @param request 
     * @param response 
     * @return int 
     */
    int getDeviceList_service_handler(const Request& request, Response& response);

   
    /**
     * 获取所有设备状态
     */
    int get_device_state_all_service_handler(const Request& request, Response& response);


  
    /**
     * @brief 分组控制
     * 
     * @param request 
     * @param response 
     * @return int 
     */
    int groupControl_service_handler(const Request& request, Response& response);

    
   
    /**
     * @brief 获取分组列表：ble, zigbee
     * 
     * @param request 
     * @param response 
     * @return int 
     */
    int getGroupList_service_handler(const Request& request, Response& response);


    /**
     * @brief 更新设备列表
     * 
     * @param request 
     * @param response 
     * @return int 
     */
    int updateDeviceList_service_handler(const Request& request, Response& response);


    /**
     * @brief 更新组列表
     * 
     * @param request 
     * @param response 
     * @return int 
     */
    int updateGroupList_service_handler(const Request& request, Response& response);


   

    /**
     * 发送消息服务
     */
    int messagePublish_service_request_handler(const Request& request, Response& response);

    
   

    /**
     * @brief 站点消息转发，部分消息会触发设备站点更新
     * 
     * @param request 
     */
    void messagePublish(const Request& request);


   

    /**
     * @brief 触发设备类站点更新
     * 
     * @param request 
     */
    void trigger_devGrp_update_messageHandle(const Request& request);


    /**
     * @brief 触发设备类站点更新、在线列表更新
     * 
     * @param request 
     */
    void trigger_dgp_update_meesageHandle(const Request& request);


    /**
     * @brief 上报日志文件
     * 
     * @param request 
     */
    void uploadLogHandler(const Request& request);
}

#endif //EXHIBITION_SERVICEREQUESTHANDLER_H
